#include "stm32f10x.h"                  // Device header
#include "draw_api.h"
#include <stdio.h>
#include <string.h>
#include <delay.h>
#include <HMI.H>

//进度条显示
void testDrawProcess()
{
	for(int i=10;i<=80;i=i+5)
	{
		ClearScreen(); 
			
		char buff[10];
		sprintf(buff,"%d%%",(int)(i/80.0*100));	
		DrawString(1,18,"STM32_C8T6");//字符显示
		DrawString(4,90,buff);//当前进度显示
		DrawProcess(10,35,80,10,i);
		UpdateScreen();
		delay_ms(10);//自由调节
	}
	delay_ms(10);
}

void DrawProcess(u8 x,u8 y,u8 w,u8 h,u8 now)
{
	DrawfillRoundRect(x,y,now,h,4);//圆角填充框矩形框
	DrawRoundRect(x,y,w,h,4);//圆角矩形	
}
//时钟显示
void RoundClock(int hours ,int minute ,int sec)
{
	unsigned char i=0;
	TypeXY hourspoint,minutepoint,secpoint,tmp1,tmp2;
	ClearScreen();//清除
	//时针
	SetRotateValue(63,31,hours*30+(minute*30)/60,1);
	hourspoint=GetRotateXY(63-14,31);
	DrawLine(63,31,hourspoint.x,hourspoint.y);
	//分针
	SetRotateValue(63,31,minute*6+(sec*6)/60,1);
	minutepoint=GetRotateXY(63-21,31);
	DrawLine(63,31,minutepoint.x,minutepoint.y);	
	//秒针
	SetRotateValue(63,31,sec*6,1);
	secpoint=GetRotateXY(63-28,31);
	DrawLine(63,31,secpoint.x,secpoint.y);
	//表盘
	for(i=0;i<12;i++)
	{
		SetRotateValue(63,31,i*30,1);
		tmp1=GetRotateXY(63-29,31);
		tmp2=GetRotateXY(63-24,31);
		DrawLine(tmp1.x,tmp1.y,tmp2.x,tmp2.y);
	}
	DrawFillCircle(63,31,2);
	DrawCircle(63,31,30);
//	UpdateScreen();
}
